package com.example.yiwei.crm.json;

import android.util.Log;


import com.example.yiwei.crm.entity.VersionEntity;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2017/10/27.
 */

public class VersionJson {

    public static VersionEntity getVersion(String result){
        VersionEntity entity;
        try {
            entity = new VersionEntity();
            JSONObject object1 = new JSONObject(result);
            JSONObject object = object1.getJSONObject("pd");
            if (object.has("APP02")){
                entity.setVersionname(object.getString("APP02"));
            }
            if (object.has("APP05")){
                entity.setUpdateContent(object.getString("APP05"));
            }
            if (object.has("APP06")){
                entity.setDownloadURL(object.getString("APP06"));
            }
            Log.d("aaa","ssssss1");
            return entity;
        } catch (JSONException e) {
            Log.d("aaa","ssssss");
            e.printStackTrace();
        }
        return null;
    }
}
